package leco;

import java.util.Arrays;

public class Leetcode455 {
    public  static void main(String[] args) {
        int[] g= new int[]{1,2,3};
        int[] s=new int[]{3};
        System.out.println(findContentChildren(g,s));
    }
    public static int findContentChildren(int[] g, int[] s) {
        int gLen = g.length;
        int sLen = s.length;
        int count=0;
        Arrays.sort(g);
        Arrays.sort(s);
        int i;int j=0;
        for(i=0;i<gLen;i++){
            for(;j<sLen;j++){
                if(s[j]>=g[i]){
                    count++;
                    j++;
                    break;
                }
            }
        }
        return count;
    }
}
